import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.PrintWriter;

public class TestFile{
	public static void main(String[] arge) throws Exception{
		//TestFile(new File("D:/db2_demp.txt"));
		String str = "che";
		String str1 = "{asdfadfs}";
		System.out.println(str1.indexOf("{"));
//		String str2 = new String("che");
//		System.out.println(str==str1);
	}

	public static void TestFile(File directory) throws Exception{
		//列目录全部文件
		if(directory.isDirectory()){
			File[] files=directory.listFiles();
			for(int i=0;i<files.length;i++){
				
			}
			
		}else{
			String fileName = directory.getName();
			File copyFile = new File("D:/copyFileTest");
			if(!copyFile.exists()){
				copyFile.mkdir();
			}
			BufferedReader br = new BufferedReader(new FileReader(directory));
			PrintWriter  bw =  new PrintWriter(new BufferedWriter(new FileWriter(
					new File("D:/copyFileTest/"+fileName)))); 
			String line = null;
			while((line=br.readLine())!=null){
				System.out.println(line);
				bw.write(line);
				bw.flush();
			}
			System.out.println("完成");
		}
	}
}